#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "InteractionFragment.h"
#include "NamedElement.h"
#include "Namespace.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class InteractionConstraint;
class InteractionFragment;

/// <summary>
/// InteractionOperand
/// An InteractionOperand is contained in a CombinedFragment. An InteractionOperand
/// represents one operand of the expression given by the enclosing
/// CombinedFragment.
/// </summary>
class UMLMODEL_EXPORT InteractionOperand : public NamedElement, public InteractionFragment, public Namespace {

public: // Constructors and destructors
    explicit InteractionOperand(const QString& umlType="uml::InteractionOperand");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// fragments getter
    /// The fragments of the operand.
    /// </summary>
    vector<shared_ptr<InteractionFragment>>& fragments();

    /// <summary>
    /// guard getter
    /// Constraint of the operand.
    /// </summary>
    shared_ptr<InteractionConstraint> guard() const;

    /// <summary>
    /// guard setter
    /// Constraint of the operand.
    /// </summary>
    void setGuard(shared_ptr<InteractionConstraint> value);

private: // Fields
    /// <summary>
    /// fragments
    /// The fragments of the operand.
    /// </summary>
    vector<shared_ptr<InteractionFragment>> fragments_;

    /// <summary>
    /// guard
    /// Constraint of the operand.
    /// </summary>
    shared_ptr<InteractionConstraint> guard_;

};

} // namespace uml
